package boni.si;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;

import boni.si.R;
import boni.si.R.drawable;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;

public class MojOverlayClassDalec extends com.google.android.maps.Overlay{

	GeoPoint p;
	
	public MojOverlayClassDalec(GeoPoint point){
		
		this.p = point;		
	}
	
	@Override
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) 
    {
        super.draw(canvas, mapView, shadow);                   
        System.out.println("MOJ OVERLAY CLASS DALEC");
        //GeoPoint se prevede v piksle na ekranu
        Point screenPts = new Point();
        mapView.getProjection().toPixels(p, screenPts);

        //dodamo marker
        Bitmap bmp = BitmapFactory.decodeResource(mapView.getResources(), R.drawable.pushpin_dalec);            
        //canvas.drawBitmap(bmp, screenPts.x, screenPts.y-64, null); //odsteti moramo visino pina 
        canvas.drawBitmap(bmp, screenPts.x-32, screenPts.y-64, null);
        return true;
    }
}
